feat(common): encode the SNARK aggregate signature as bytes in the certificate message - #3437
Merged
jpraynaud merged 5 commits intoAug 5, 2026
Merged
Conversation
jpraynaud
temporarily deployed
to
testing-2-preview
July 27, 2026 15:37 — with
GitHub Actions
Inactive
jpraynaud
temporarily deployed
to
testing-preview
July 27, 2026 15:37 — with
GitHub Actions
Inactive
jpraynaud
force-pushed
the
jpraynaud/3379-fix-snark-aggregate-signature-encoding
branch
2 times, most recently
from
July 28, 2026 15:39
897008f to
a37adb3
Compare
jpraynaud
marked this pull request as ready for review
July 28, 2026 16:29
jpraynaud
requested review from
Alenar,
curiecrypt,
damrobi,
hjeljeli32 and
turmelclem
as code owners
July 28, 2026 16:29
There was a problem hiding this comment.
Pull request overview
This PR updates how certificate-related cryptographic payloads are encoded so that SNARK/IVC proofs use a more compact byte-string CBOR representation (and bytes-hex on the wire where applicable), while keeping concatenation proofs backward compatible via JSON-hex encoding. This aligns certificate message/record serialization with the ProtocolKey codec to ensure consistent encoding decisions by aggregate signature type.
Changes:
- Emit CBOR byte strings for proof byte vectors by using
serde_bytesfor SNARK/IVC proof fields and the aggregate signature CBOR envelope. - Route certificate message and DB record encoding through
String::try_from(&ProtocolKey<...>)to centralize encoding decisions in theProtocolKeyCodec. - Introduce a custom
ProtocolKeyCodecforAggregateSignaturethat encodes concatenation as JSON-hex and (when enabled) SNARK/IVC as bytes-hex.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mithril-stm/src/protocol/aggregate_signature/signature.rs | Encodes CBOR envelope proof_bytes as a CBOR byte string and updates golden CBOR fixtures accordingly. |
| mithril-stm/src/proof_system/halo2_snark/proof.rs | Serializes SNARK circuit_proof with serde_bytes for compact CBOR bytes. |
| mithril-stm/src/circuits/halo2_ivc/types.rs | Serializes IVC proof byte wrapper with serde_bytes for compact CBOR bytes. |
| mithril-stm/Cargo.toml | Adds serde_bytes dependency (and ignores it for cargo-machete). |
| mithril-common/src/messages/certificate.rs | Uses ProtocolKey codec (String::try_from) for certificate crypto fields; adds tests for multi-signature encoding by type. |
| mithril-common/src/crypto_helper/types/wrappers.rs | Implements custom ProtocolKeyCodec for AggregateSignature to encode by signature type (JSON-hex vs bytes-hex). |
| mithril-aggregator/src/database/record/certificate.rs | Stores certificate signatures/keys via ProtocolKey codec (String::try_from) and adds a test for SNARK multi-signature storage encoding. |
| Cargo.lock | Locks the new serde_bytes dependency. |
jpraynaud
temporarily deployed
to
testing-2-preview
July 28, 2026 16:33 — with
GitHub Actions
Inactive
jpraynaud
temporarily deployed
to
testing-preview
July 28, 2026 16:33 — with
GitHub Actions
Inactive
Alenar
approved these changes
Aug 4, 2026
Encode the multi-signature by type through the ProtocolKey codec: JSON-hex for concatenation (backward compatible), bytes-hex for SNARK and IVC proofs.
…codec The record now encodes the certificate crypto fields via the ProtocolKey codec, so the served SNARK multi-signature is bytes-hex instead of JSON-hex.
Serialize the aggregate signature and proof byte vectors as byte strings instead of arrays of integers, which halves their encoded size at each nesting level.
* mithril-aggregator from `0.9.19` to `0.9.20` * mithril-common from `0.7.15` to `0.7.16` * mithril-stm from `0.12.1` to `0.12.2`
jpraynaud
force-pushed
the
jpraynaud/3379-fix-snark-aggregate-signature-encoding
branch
from
August 4, 2026 16:18
a37adb3 to
59773cf
Compare
jpraynaud
temporarily deployed
to
testing-preview
August 4, 2026 17:12 — with
GitHub Actions
Inactive
jpraynaud
temporarily deployed
to
testing-2-preview
August 4, 2026 17:12 — with
GitHub Actions
Inactive
jpraynaud
deleted the
jpraynaud/3379-fix-snark-aggregate-signature-encoding
branch
August 5, 2026 06:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Content
This PR includes the encoding of the certificate message aggregate signature by type, so SNARK and IVC proofs use the compact bytes-hex encoding while concatenation proofs remain backward compatible:
multi_signaturefield by aggregate signature type: JSON-hex for concatenation proofs (backward compatible with all deployed clients) and bytes-hex for SNARK and IVC proofs.ProtocolKeycodec (String::try_from) instead of an explicit bytes-hex call.Pre-submit checklist
Issue(s)
Closes #3379